//
//  WPMineInforamationVC.m
//  wobingwoyi
//
//  Created by WGP on 16/9/7.
//  Copyright © 2016年 WGP. All rights reserved.
//

#import "WPMineInforamationVC.h"
#import "WPMineInfomationCell.h"
#import "WPSystemRecommendedVC.h"
#import "WPPrivateInfoTVC.h"
#import "WPRecommendedTVC.h"
#import "SwipeBack.h"

@interface WPMineInforamationVC ()<UITableViewDelegate,UITableViewDataSource>

@property(nonatomic,strong)UITableView *tableView;

@end

@implementation WPMineInforamationVC

- (void)viewDidLoad {
    [super viewDidLoad];
   
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
    
    if (self.isNotifactionDidClick)
    {
        self.navigationController.navigationBar.hidden = YES;
    }
    
    self.titleLabel.text = @"我的消息";
    
    [self tableView];
}

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
    [self.tableView reloadData];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
}

-(UITableView *)tableView
{
    if (_tableView == nil)
    {
        _tableView = [[UITableView alloc] init];
        //注册cell
        [_tableView registerClass:[WPMineInfomationCell class] forCellReuseIdentifier:@"WPMineInfomationCell"];
        _tableView.bounces = NO;
        _tableView.backgroundColor = GlobalBgColor;
        _tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 10)];
        _tableView.tableFooterView = [UIView new];
        _tableView.rowHeight = 65;
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        _tableView.delegate = self;
        _tableView.dataSource = self;
        [self.view addSubview:_tableView];
        
        [_tableView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.navBarView.mas_bottom);
            make.left.right.bottom.equalTo(self.view);
        }];
    }
    return _tableView;
}

#pragma mark - 数据源代理方法

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 2;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    WPMineInfomationCell *cell = [tableView dequeueReusableCellWithIdentifier:@"WPMineInfomationCell"];
    cell.indexPath = indexPath;
    
    return cell;
    
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(indexPath.item == 0)
   {
       WPPrivateInfoTVC *vc = [WPPrivateInfoTVC new];
       [self.navigationController pushViewController:vc animated:YES];
   }
    else
    {
        WPRecommendedTVC *vc = [WPRecommendedTVC new];
        [self.navigationController pushViewController:vc animated:YES];
    }
}


-(void)backBtnDidClick
{
    if (self.isNotifactionDidClick)
    {
        [self.navigationController dismissViewControllerAnimated:YES completion:nil];
    }
    else
    {
        [self.navigationController popViewControllerAnimated:YES];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
